package edu.vt.ece3574.ninjatag;

import android.app.TabActivity;
import android.content.Intent;
import android.os.Bundle;
import android.widget.TabHost;

public class GPS_Activity extends TabActivity {
    /** Called when the activity is first created. */
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.gps_activity);
        
        // Resources res = getResources();	// Resource object to get Drawables
        TabHost tabHost = getTabHost();		// The activity TabHost
        TabHost.TabSpec spec;				// Reusable TabSpec for each tab
        Intent intent;						// Reusable Intent for each tab

        // Create an Intent to launch an Activity for the tab (to be reused)
        intent = new Intent().setClass(this, GPS_Tab.class);

        // Initialize a TabSpec for each tab and add it to the TabHost
        spec = tabHost.newTabSpec("gps").setIndicator("GPS").setContent(intent);
        tabHost.addTab(spec);

        // Do the same for the other tabs
        intent = new Intent().setClass(this, Satellite_Tab.class);
        spec = tabHost.newTabSpec("satellite").setIndicator("Satellites").setContent(intent);
        tabHost.addTab(spec);

        intent = new Intent().setClass(this, Settings_Tab.class);
        spec = tabHost.newTabSpec("gps_settings").setIndicator("GPS Settings").setContent(intent);
        tabHost.addTab(spec);

        tabHost.setCurrentTab(1);
        
        startService(new Intent(this, LocationService.class));
    }
    
    @Override
	public void onBackPressed(){
		Intent newIntent = new Intent(GPS_Activity.this, settings_screen.class);
		startActivity(newIntent);
		return;
	}
    
}